home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 376-400 / disk_386 / xlispstat / src1.lzh / Headers / iviewdef.h < prev    next >
C/C++ Source or Header  |  1990-06-15  |  16KB  |  461 lines

  1. #ifndef IVIEWDEF_H
  2. #define IVIEWDEF_H
  3.  
  4. #ifndef AMIGA
  5. #ifndef UNIX
  6. #ifndef MACINTOSH
  7. #define MACINTOSH
  8. #endif
  9. #endif
  10. #endif
  11.  
  12. #ifndef AMIGA
  13. #ifndef _IVIEWWINDOW_
  14. # define WindowPtr long
  15. # define Window long
  16. # define MenuHandle long
  17. # define Menu long
  18. #else
  19. #ifdef MACINTOSH
  20. # ifdef MPWC
  21. #  include <Quickdraw.h>
  22. #  include <Windows.h>
  23. #  include <Menus.h>
  24. #  include <Dialogs.h>
  25. #  include <ToolUtils.h>
  26. #  include <Events.h>
  27. #  include <OSEvents.h>
  28. #  include <Controls.h>
  29. #  include <Lists.h>
  30. #  include <Memory.h>
  31. #  include <Fonts.h>
  32. #  include <Script.h>
  33. #  define thePort qd.thePort
  34. #  define arrow qd.arrow
  35. #  define MBarHeight GetMBarHeight()
  36. #  define MemErr MemError()
  37. #  define RETURNCHAR '\n'
  38. # else
  39. # undef FALSE /* to avoid some conflicts */
  40. # undef TRUE
  41. #  include <WindowMgr.h>    /* pulls in MacTypes, QuickDraw */
  42. #  include <MenuMgr.h>
  43. #  include <ToolboxUtil.h>
  44. #  include <EventMgr.h>
  45. #  include <DialogMgr.h>
  46. #  include <ControlMgr.h>
  47. #  include <FontMgr.h>
  48. #  include <MemoryMgr.h>
  49. #  include <FontMgr.h>
  50. #  include <pascal.h>
  51. #  define FALSE 0
  52. #  define TRUE 1
  53. #  define ModalFilterProcPtr ProcPtr
  54. #  define RETURNCHAR '\r'
  55. # endif MPWC
  56. #endif MACINTOSH
  57. #endif _IVIEWWINDOW_
  58. #endif AMIGA
  59.  
  60. #ifdef MACINTOSH
  61. #define IVIEW_WINDOW WindowPtr
  62. #define IVIEW_MENU MenuHandle
  63. #endif MACINTOSH
  64. #ifdef UNIX
  65. #define IVIEW_WINDOW Window
  66. #define IVIEW_MENU Menu
  67. #endif UNIX
  68. #ifdef AMIGA
  69. #include <proto/intuition.h>
  70. typedef struct Window * IVIEW_WINDOW;
  71. typedef struct Menu   * IVIEW_MENU;
  72. #endif AMIGA
  73.  
  74. #ifndef MACINTOSH
  75. #ifdef SUNVIEW
  76. #undef SUNVIEW  /* to avoid a conflict in include files */
  77. #include <suntool/sunview.h>
  78. #include <suntool/canvas.h>
  79. #include <suntool/panel.h>
  80. #include <pixrect/pixrect_hs.h>
  81.  
  82. typedef struct {
  83.   int h, v;
  84. } Point;
  85.  
  86. #else
  87. #ifdef AMIGA
  88. #define Point POINT
  89. #endif AMIGA
  90. typedef struct {
  91.   int h, v;
  92. } Point;
  93. typedef struct {
  94.   int left, top, width, height; /* right changed to top JKL */
  95. } Rect;
  96. #endif SUNVIEW
  97. #endif MACINTOSH
  98.  
  99. #define nil 0L
  100.  
  101. typedef short ColorCode; /* changed JKL */
  102.  
  103. typedef enum {
  104.   MouseClick = 0,
  105.   MouseMove = 1
  106. } MouseEventType;
  107.  
  108. typedef enum {
  109.   NoModifiers = 0,
  110.   ExtendModifier = 1,
  111.   OptionModifier = 2,
  112.   OptionExtendModifier = 3
  113. } MouseClickModifier;
  114.  
  115. typedef enum {
  116.   pointInvisible,
  117.   pointNormal,
  118.   pointHilited,
  119.   pointSelected
  120. } PointState;
  121.  
  122. typedef enum {
  123.   selecting,
  124.   brushing,
  125.   usermode
  126. } MouseMode;
  127.  
  128. #define ARROW_CURSOR      0
  129. #define WATCH_CURSOR      1
  130. #define CROSS_CURSOR      2
  131. #define BRUSH_CURSOR      3
  132. #define HAND_CURSOR       4
  133. #define FINGER_CURSOR     5
  134. #define HOUR_GLASS_CURSOR 6
  135. #define TRASH_BAG_CURSOR  7
  136. #define TRASH_CAN_CURSOR  8
  137.  
  138. #define BASIC_IVIEW 0
  139.  
  140. #ifndef AMIGA
  141. typedef char *IVIEW_WINDOW;
  142. #endif AMIGA
  143.  
  144. typedef void *IViewReallocData;
  145.  
  146. #ifdef MACINTOSH  /* moved from stmem.c   JKL */
  147. typedef char **StReallocData;
  148. #else
  149. typedef struct{
  150.   int size;
  151.   char *data; /* cannot be void because of bzero in stmem.c JKL */
  152. } realloc_data, *StReallocData;
  153. #endif MACINTOSH
  154.  
  155. /**************************************************************************/
  156. /**************************************************************************/
  157. /**                                                                      **/
  158. /**                         IViewBasicPoints Package                     **/
  159. /**                                                                      **/
  160. /**************************************************************************/
  161. /**************************************************************************/
  162.  
  163. typedef struct basic_points {
  164.   int num_points, num_variables;
  165.   double *scale, *location, **transformation;
  166.   StReallocData *data, *screen_data;
  167.   int recalculateScreenPoints, fixed;
  168. } *IViewBasicPoints;
  169.  
  170. /**************************************************************************/
  171. /**************************************************************************/
  172. /**                                                                      **/
  173. /**                            IViewData Package                         **/
  174. /**                                                                      **/
  175. /**************************************************************************/
  176. /**************************************************************************/
  177.  
  178. #define color_index ColorCode /* added JKL */
  179.  
  180. typedef short color_index; /* changed JKL */
  181.  
  182. typedef struct point_symbol {
  183.   int normal, highlighted;
  184. } PointSymbol;
  185.  
  186. typedef struct point_info {
  187.   PointState state, screen_state;
  188.   char marked, masked;
  189.   color_index color;
  190.   PointSymbol symbol;
  191.   char *label;
  192. } PointInfo;
  193.  
  194. typedef struct line_info {
  195.   int next, type;
  196.   char masked, width;
  197.   color_index color;
  198. } LineInfo;
  199.  
  200. typedef struct string_info {
  201.   char *string;
  202.   char masked, up, h, v;
  203.   color_index color;
  204. } StringInfo;
  205.  
  206. typedef struct iview_data {
  207.   IViewBasicPoints points, lines, strings;
  208.   IViewReallocData pointInfo, lineInfo, stringInfo;
  209.   double *mins, *maxes, *scale, *location;
  210.   int *screen_mins, *screen_maxes;
  211.   char **variableLabels;
  212.   int recalculateScreenPoints, transformed;
  213.   double **transformation;
  214. } *IViewDATA; /* changed because IViewData defined as a function   JKL */
  215.  
  216. typedef struct brush {
  217.   int left, top, width, height, showing;
  218. } Brush;
  219.  
  220. typedef struct clickrange {
  221.   int width, height;
  222. } ClickRange;
  223.  
  224. typedef struct content {
  225.   int left, top, width, height, origin_x, origin_y, x_variable, y_variable;
  226. } Content;
  227.  
  228. typedef struct {
  229.   int left, top, right, bottom;
  230. } Margin;
  231.  
  232. typedef struct {
  233.   int showing, labeled, ticks, height, edge;
  234. } Axis;
  235.  
  236. typedef struct iview {
  237.   /* char * */IViewDATA data; /* changed JKL */
  238.   Content content;
  239.   Margin margin;
  240.   Axis x_axis, y_axis;
  241.   Brush brush;
  242.   ClickRange clickrange;
  243.   MouseMode mouseMode;
  244.   int showingLabels, fixed_aspect, dirty;
  245.   long links;
  246.   double *scale, *shift;
  247. } *IView;
  248.  
  249. /* General Data Macros */
  250. #define IViewNumVariables(w) IViewDataNumVariables(IViewData(w))
  251. #define IViewSetVariableLabel(w, var, s) IViewDataSetVariableLabel(IViewData(w), var, s)
  252. #define IViewVariableLabel(w, var) IViewDataVariableLabel(IViewData(w), var)
  253. /* following two changed to Scaled as in iview.c JKL */
  254. #define IViewSetScaledRange(w, var, low, high) IViewDataSetRange(IViewData(w), var, low, high)
  255. #define IViewGetScaledRange(w, var, low, high) IViewDataGetRange(IViewData(w), var, low, high)
  256. #define IViewSetScreenRange(w, var, low, high) IViewDataSetScreenRange(IViewData(w), var, low, high)
  257. #define IViewGetScreenRange(w, var, low, high) IViewDataGetScreenRange(IViewData(w), var, low, high)
  258. #define IViewSetIdentityTransformation(w) IViewDataSetIdentityTransformation(IViewData(w))
  259. #define IViewSetTransformation(w, a) IViewDataSetTransformation(IViewData(w), a)
  260. #define IViewTransformation(w) IViewDataTransformation(IViewData(w))
  261. #define IViewIsTransformed(w) IViewDataIsTransformed(IViewData(w))
  262. #define IViewApplyTransformation(w, a, inbasis) IViewDataApplyTransformation(IViewData(w), a, inbasis)
  263.  
  264. /* Point Data Macros */
  265. #define IViewAddPoints(w, n) IViewDataAddPoints(IViewData(w), n)
  266. #define IViewClearPoints(w) IViewDataClearPoints(IViewData(w))
  267. #define IViewNumPoints(w) IViewDataNumPoints(IViewData(w))
  268. /* next two changed to agree with iview.c JKL */
  269. #define IViewSetPointValue(w, var, point, value) \
  270.         IViewDataSetPointValue(IViewData(w), var, point, IViewEncodeValue(w,value,var))
  271. #define IViewPointValue(w, var, point) IViewDecodeValue(w, \
  272.                    IViewDataPointValue(IViewData(w), var, point),var)
  273. /* next three added from iview.c JKL */
  274. #define IViewSetPointScaledValue(w, var, point, value) IViewDataSetPointValue(IViewData(w), \
  275.                    var, point, value)
  276. #define IViewPointScaledValue(w, var, point) IViewDataPointValue(IViewData(w), var, point)
  277. #define IViewPointTransformedValue(w, var, point) IViewDataPointTransformedValue(IViewData(w), \
  278.                    var, point)
  279. #define IViewPointScreenValue(w, var, point) IViewDataPointScreenValue(IViewData(w), var, point)
  280. #define IViewGetScreenPointValues(w, point, x) IViewDataGetScreenPointValues(IViewData(w), point, x)
  281. #define IViewSetPointMask(w, point, masked) IViewDataSetPointMask(IViewData(w), point, masked)
  282. #define IViewPointMasked(w, point) IViewDataPointMasked(IViewData(w), point)
  283. /* next two added from iview.c JKL */
  284. #define IViewSetPointColor(w, point, color) IViewDataSetPointColor(IViewData(w), point, color)
  285. #define IViewPointColor(w, point) IViewDataPointColor(IViewData(w),  point)
  286. /* left as a function in iview.c JKL
  287. #ifdef AMIGA   does not work with Lattice ?? JKL
  288. #define IViewSetPointState(w, point, state) IViewDataSetPointState(IViewData(w), point, state); \
  289.   if (IViewIsLinked(w)) IViewMatchPointState(w, point)
  290. #else
  291. #define IViewSetPointState(w, point, state) (IViewDataSetPointState(IViewData(w), point, state), \
  292.   if (IViewIsLinked(w)) IViewMatchPointState(w, point))
  293. #endif AMIGA
  294. */
  295. #define IViewPointState(w, point) IViewDataPointState(IViewData(w),  point)
  296. #define IViewSetPointScreenState(w, point, state) IViewDataSetPointScreenState(IViewData(w), point, state)
  297. #define IViewPointScreenState(w, point) IViewDataPointScreenState(IViewData(w),  point)
  298. #define IViewResetScreenStates(w) IViewDataResetScreenStates(IViewData(w))
  299. #define IViewSetPointMark(w, point, marked) IViewDataSetPointMark(IViewData(w), point, marked)
  300. #define IViewPointMarked(w, point) IViewDataPointMarked(IViewData(w),  point)
  301. #define IViewClearPointMarks(w) IViewDataClearPointMarks(IViewData(w))
  302. #define IViewSetPointLabel(w, point, s) IViewDataSetPointLabel(IViewData(w), point, s)
  303. #define IViewPointLabel(w, point) IViewDataPointLabel(IViewData(w), point)
  304. #define IViewSetPointSymbol(w, point, sym, hsym) IViewDataSetPointSymbol(IViewData(w),  point, sym, hsym)
  305. #define IViewGetPointSymbol(w, point, sym, hsym) IViewDataGetPointSymbol(IViewData(w),  point, sym, hsym)
  306.  
  307. /* Line Data Macros */
  308. #define IViewNumLines(w) IViewDataNumLines(IViewData(w))
  309. #define IViewAddLines(w, n) IViewDataAddLines(IViewData(w), n)
  310. #define IViewClearLines(w) IViewDataClearLines(IViewData(w))
  311. /* next two changed as in iview.c JKL */
  312. #define IViewSetLineValue(w, var, line, value) IViewDataSetLineValue(IViewData(w), var, line, \
  313.                      IViewEncodeValue(w, value,var))
  314. #define IViewLineValue(w, var, line) IViewDecodeValue(w,IViewDataLineValue(IViewData(w), \
  315.                      var, line), var)
  316. /* next three added as in iview.c JKL */
  317. #define IViewSetLineScaledValue(w, var, line, value) IViewDataSetLineValue(IViewData(w), \
  318.                      var, line, value)
  319. #define IViewLineScaledValue(w, var, line) IViewDataLineValue(IViewData(w), var, line)
  320. #define IViewLineTransformedValue(w, var, line) IViewDataLineTransformedValue(IViewData(w), \
  321.                      var, line)
  322. #define IViewLineScreenValue(w, var, line) IViewDataLineScreenValue(IViewData(w), var, line)
  323. #define IViewSetLineMask(w, line, masked) IViewDataSetLineMask(IViewData(w), line, masked)
  324. #define IViewLineMasked(w, line) IViewDataLineMasked(IViewData(w), line)
  325. /* next two added as in iview.c JKL */
  326. #define IViewSetLineColor(w, line, color) IViewDataSetLineColor(IViewData(w), line, color)
  327. #define IViewLineColor(w, line) IViewDataLineColor(IViewData(w), line)
  328. #define IViewSetNextLine(w, line, next) IViewDataSetNextLine(IViewData(w), line, next)
  329. #define IViewNextLine(w, line) IViewDataNextLine(IViewData(w), line)
  330. #define IViewSetLineType(w, line, type) IViewDataSetLineType(IViewData(w), line, type)
  331. #define IViewLineType(w, line) IViewDataLineType(IViewData(w), line)
  332. /* next two macros added as in iview.c JKL */
  333. #define IViewSetLineWidth(w, line, width) IViewDataSetLineWidth(IViewData(w), line, width)
  334. #define IViewGetLineWidth(w, line, width) IViewDataGetLineWidth(IViewData(w), line, width)
  335.  
  336. #ifdef USESTRINGS
  337. /* String Data Macros */
  338. #define IViewNumStrings(w) IViewDataNumStrings(IViewData(w))
  339. #define IViewAddStrings(w, n) IViewDataAddStrings(IViewData(w), n)
  340. #define IViewClearStrings(w) IViewDataClearStrings(IViewData(w))
  341. #define IViewSetStringValue(w, var, string, value) IViewDataSetStringValue(IViewData(w), var, string, value)
  342. #define IViewStringValue(w, var, string) IViewDataStringValue(IViewData(w), var, string)
  343. #define IViewStringScreenValue(w, var, string) IViewDataStringScreenValue(IViewData(w), var, string)
  344. #define IViewSetStringMask(w, string, masked) IViewDataSetStringMask(IViewData(w), string, masked)
  345. #define IViewStringMasked(w, string) IViewDataStringMasked(IViewData(w),  string)
  346. #define IViewSetStringString(w, string, str) IViewDataSetStringString(IViewData(w), string, str)
  347. #define IViewStringString(w, string) IViewDataStringString(IViewData(w), string)
  348. #define IViewSetStringModifiers(w, string, up, h, v) IViewDataSetStringModifiers(IViewData(w), string, up, h, v)
  349. #define IViewGetStringModifiers(w, string, up, h, v) IViewDataSetStringModifiers(IViewData(w), string, up, h, v)
  350. #endif USESTRINGS
  351.  
  352. /* dialog item types */
  353. #define NULL_ITEM        0
  354. #define BUTTON_ITEM      1
  355. #define TOGGLE_ITEM      2
  356. #define CHOICE_ITEM      3
  357. #define MESSAGE_ITEM     4
  358. #define TEXT_ITEM        5
  359. #define SCROLL_ITEM      6
  360. #define REAL_SCROLL_ITEM 7
  361. #define LIST_ITEM        8
  362. #define ITEM_LIST        9
  363.  
  364. #define has_item_location(i) (slot_value(i, s_location) != NIL)
  365. #define has_item_size(i) (slot_value(i, s_size) != NIL)
  366. #define check_dialog_address(d) valid_dialog_address(slot_value(d, s_hardware_address))
  367.  
  368. /***********************************************************************/
  369. /*                    Machine Dependent Definitions                    */
  370. /***********************************************************************/
  371.  
  372. #ifdef MACINTOSH
  373. typedef struct {
  374.   LVAL object;
  375.   int count;
  376. } DialogData;
  377.  
  378. typedef struct {
  379.   int type;
  380.   int itemNumber, clusterLeader, clusterSize;
  381.   Handle itemHandle;
  382.   LVAL object;
  383. } DialogItemData;
  384.  
  385. #define DialogItemCount(d) (**(short **)(((DialogPeek) d)->items) + 1)
  386. #define GetDialogObject(d) ((*((DialogData **) GetWRefCon(d)))->object)
  387. #define SetDialogObject(d, obj) (GetDialogObject(d) = obj)
  388. #define GetDialogData(d) ((DialogData **) GetWRefCon(d))
  389.  
  390. extern DialogItemData *GetDialogItemData(), FindItemData();
  391.  
  392. typedef struct {
  393.   long Object;                                /* elements of window_data */
  394.   int idleOn, frontOnly;                      /* elements of window_data */
  395.   int mouse_x, mouse_y;                       /* elements of window_data */
  396.   WindowPtr window;
  397.   int (*FreeMem)();
  398.   ColorCode backColor, drawColor;
  399.   int canvasWidth, canvasHeight;
  400.   int lineType, drawMode, lineWidth;
  401.   long RefCon;
  402.   int use_color;
  403.   int hasHscroll, hasVscroll, view_h, view_v;
  404.   int v_scroll_inc[2], h_scroll_inc[2];
  405.   ControlHandle hscroll, vscroll;
  406.   int initialized;
  407.   int symbolMode;
  408.   int cursor;
  409.   Rect clip_rect;
  410.   int clipped;
  411. } StGWWinInfo;
  412.  
  413. #endif MACINTOSH
  414.  
  415. #ifdef AMIGA
  416.  
  417. typedef struct {
  418.    int type,itemNumber,clusterLeader,clusterSize;
  419.    struct Gadget *itemPtr;
  420.    LVAL object;}
  421. DialogItemData;
  422.  
  423. typedef struct {
  424.    LVAL object;
  425.    int count;
  426.    struct Gadget *gadl;
  427.    struct DialogItemData *pid;}
  428. DialogData;
  429.  
  430. typedef struct Window *DialogPtr;
  431.  
  432. #define GetDialogData(d)       ((DialogData *)(d->UserData))
  433. #define DialogItemCount(d)     count_hardware_items(slot_value(GetDialogObject(d),s_items))
  434. #define GetDialogObject(d)     (((StGWWinInfo *)GetDialogData(d))->Object)
  435. #define SetDialogObject(d,obj) (GetDialogObject(d)=obj)
  436.  
  437. typedef struct {
  438.   LVAL Object;                               /* elements of window_data */
  439.   int idleOn,frontOnly;                      /* elements of window_data */
  440.   int mouse_x,mouse_y;                       /* elements of window_data */
  441.   struct Window *window;
  442. /*  void (*FreeMem)(IVIEW_WINDOW);*/
  443.   ColorCode backColor,drawColor;
  444.   int canvasWidth,canvasHeight;
  445.   int lineType,drawMode,lineWidth;
  446.   IView RefCon;
  447.   int use_color;
  448.   int hasHscroll,hasVscroll,view_h,view_v;
  449.   int v_scroll_inc[2],h_scroll_inc[2];
  450.   struct Gadget *hscroll,*vscroll;
  451.   int initialized;
  452.   int symbolMode;
  453.   int cursor;
  454.   int clipped;
  455.   Rect clip_rect;
  456. } StGWWinInfo;
  457.  
  458. #endif AMIGA
  459.  
  460. #endif IVIEWDEF_H
  461.